package Day18;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int x = scan.nextInt();
        int[] arr1 = new int[n+1];
        int[] arr2 = new int[n+1];
        long max = 0;
        for(int i = 1; i <= n; i++){
          int a = scan.nextInt();
          arr1[a]++;
          arr2[i] = a;
          if(arr1[arr2[i]] <= x){
            max = Math.max(max, (long)arr2[i] * arr1[arr2[i]]);
          }
        }
        System.out.println(max);
        scan.close();
    }
}